<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<title>Document</title>
</head>
<body>
	<div>这里是SockJS客户端</div>
</body>
<script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.5.1/jquery.js"></script>
<script src="https://cdn.jsdelivr.net/npm/sockjs-client@1/dist/sockjs.min.js"></script>
<script>
	$(function(){
		var sock = new SockJS('http://localhost:8080/sockjs-node');
		sock.onopen = function() {
			console.log('open');
			sock.send('test');
		};
		
		sock.onmessage = function(e) {
			console.log('message', e.data);
		};
		
		sock.onclose = function() {
			console.log('close');
		};
	})
</script>
</html>